#include <limits.h>
#include "Common.h"
#include "LedUtils.h"
#include "ProgramHandler.h"
#include "BlueSwitch.h"
#include "EyeSwitches.h"
#include "HeadPots.h"
#include "UltrasonicReceiver.h"
#include "ShellButtons.h"

/* common variables */
namespace globals 
{
  // volatile ProgramModeEnum ProgramMode;
  volatile short TransposeOffset = 0; 
}

unsigned long EyeSwitches::NextCheckTimeInMs = 0;
bool EyeSwitches::StateSwitchLeft;
bool EyeSwitches::StateSwitchRight;
bool EyeSwitches::IsStateChanged = true;

unsigned long HeadPots::NextCheckTimeInMs = 0;
byte HeadPots::PotLeftValue;
byte HeadPots::PotRightValue;
bool HeadPots::IsStateChanged = true;

unsigned long UltrasonicReceiver::NextCheckTimeInMs = 0;
int UltrasonicReceiver::MaximumRange = 350; // Maximum range needed
int UltrasonicReceiver::MinimumRange = 40; // Minimum range needed
long UltrasonicReceiver::Duration; // Duration used to calculate distance distance in milimeters
long UltrasonicReceiver::Distance; // Last computed distance in mm in the range MinimumRange <= Distance <=MaximumRange
bool UltrasonicReceiver::IsStateChanged = true;

unsigned long BlueSwitch::NextCheckTimeInMs = 0;
byte BlueSwitch::BlueSwitchState;
bool BlueSwitch::IsStateChanged = true;

volatile byte ShellButtons::LastKnownInterruptCounter = 0xFF;
volatile byte ShellButtons::InterruptCounter = 0;
volatile bool ShellButtons::IsStateChanged = true;
volatile bool ShellButtons::ButtonStates[5];
volatile bool ShellButtons::ButtonStatesPreset[5];
volatile byte ShellButtons::ButtonMidiNoteMapping[5];
volatile unsigned long ShellButtons::ButtonStateLastEventTime[5] = {ULONG_MAX,ULONG_MAX,ULONG_MAX,ULONG_MAX,ULONG_MAX};


